﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Xna.Framework.Graphics;
using PloobsEngine.SceneControl;
using PloobsEngine.Physics;
using PloobsEngine;
using PloobsEngine.Cameras;
using PloobsEngine.Input;
using Microsoft.Xna.Framework;
using PloobsEngine.Physics.Bepu;
using PloobsEngine.Modelo;
using PloobsEngine.Material;
using PloobsEngine.Utils;
using PloobsEngine.Features;
using PloobsEngine.Commands;
using PloobsEngine.Light;
using PloobsEngine.Factories;

namespace Etapa1.Screens
{    
    public class LoadSerializableScreen : SceneScreen
    {
        private JigLibxWorld physicWorld;
        private BrutalForceWorld mundo;
        private EngineStuff engine;
        private Manager manager;

        IObject obj = null;

        public LoadSerializableScreen(EngineStuff es)
        {
            this.engine = es;
            engine.BackGroundColor = Color.Sienna;
            physicWorld = new JigLibxWorld(new GenericDebugDrawn(engine));
            physicWorld.isDebugDraw = true;
            mundo = new BrutalForceWorld(physicWorld);
            manager = engine.Manager;

        }

        public override void LoadContent(EngineStuff es)
        {            
            base.LoadContent(es);

            WorldSerializator ws = new WorldSerializator(engine);
            this.World = ws.DeSerialize("world.xml");

            ILight luz = this.World.GetWorldEntityByName<ILight>("Light");
            IObject obj = this.World.GetWorldEntityByName<IObject>("Obj");

            
            ////Criacao de uma Tecnica
            DeferredRenderTechnic dr = new DeferredRenderTechnic(engine);
            dr.DeferredLightMap = new ShadowLightMap();
            dr.isPhysicDebug = true;

            IRenderTechnic[] rt = new IRenderTechnic[] { dr };

            this.RenderTechnics = rt;                     

        }


    }
}
